package com.ww.springboot.mybatis.common.en;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 店铺类型枚举
 *
 * @author wanwei
 * @since 2021-04-14 11:47
 */
@AllArgsConstructor
@NoArgsConstructor
@Getter
public enum StoreTypeEnum {

    ALL(1, "全部店铺可用"),
    WHITE_LIST(2, "部分店铺可用"),
    BLACK_LIST(3, "部分店铺不可用");

    private Integer value;

    private String text;

    public static StoreTypeEnum getByValue(Integer value) {
        for (StoreTypeEnum storeTypeEnum : StoreTypeEnum.values()) {
            if (storeTypeEnum.getValue().equals(value)) {
                return storeTypeEnum;
            }
        }
        return null;
    }

    public static String getTextByValue(Integer value) {
        for (StoreTypeEnum storeTypeEnum : StoreTypeEnum.values()) {
            if (storeTypeEnum.getValue().equals(value)) {
                return storeTypeEnum.getText();
            }
        }
        return null;
    }
}
